<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<c:set value="${requestScope.response.data.one }" var="one" />
<jsp:useBean class="com.wsh.shop.users.pojo.AUsers" id="pojo"/>
<!DOCTYPE HTML>
<html>
    <head>
        <%@ include file="/common/include/title_back.jsp"%>
        <title>查看用户 - 用户中心</title>
    </head>
    <body>
        <nav class="breadcrumb">
            <i class="Hui-iconfont">&#xe67f;</i> 首页 
            <span class="c-gray en">&gt;</span> 用户管理 
            <span class="c-gray en">&gt;</span> 查看用户
            <a class="btn btn-success radius r"
                style="line-height: 1.6em; margin-top: 3px"
                href="javascript:location.replace(location.href);" title="刷新">
                <i class="Hui-iconfont">&#xe68f;</i>
            </a>
        </nav>
        <article class="page-container">
            <form class="form form-horizontal" id="formSubmit" action="${rootPath }/back/UsersBackServlet?method=usersUpdateSubmit">
                <input type="hidden" name="id" value="${one.id }">
                <input type="hidden" name="operType" value="update">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red"></span>邮箱：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        ${one.email }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">昵称：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        ${one.nickName }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">真实姓名：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        ${one.trueName }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">手机号：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        ${one.phone }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">性别：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        ${one.sexStr}
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">创建时间：</label>
                    <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                        ${one.createTime }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">更新时间：</label>
                    <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                        ${one.updateTime }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">上次登陆时间：</label>
                    <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                        ${one.lastLoginTime }
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">状态：</label>
                    <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                        <c:set value="1" var="currCount"/>
                        <c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
                            <c:if test="${fn:startsWith(me.key,'STATUS')}">
                                <!-- 拆分,按照-拆分,取最后一个 -->
                                <c:set value="${fn:split(me.key, '-')}" var="keys"/>
                                <div class="radio-box">
                                    <label for="${me.key }">
                                        <input type="radio" id="${me.key }" name="status" value="${keys[1] }" ${keys[1] == one.status ? 'checked' : '' }>
                                        &nbsp;${me.value }
                                    </label>
                                </div>
                                <c:set value="${currCount + 1 }" var="currCount"/>
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="row cl">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                        <button 
                            class="btn btn-primary radius" type="submit">
                            <i class="Hui-iconfont">&#xe632;</i> 提交
                        </button>
                    </div>
                </div>
            </form>
        </article>
        <%@ include file="/common/include/footer_back.jsp" %>
        <script type="text/javascript">
		    $(function(){
		        $('.skin-minimal input').iCheck({
		            checkboxClass: 'icheckbox-blue',
		            radioClass: 'iradio-blue',
		            increaseArea: '20%'
		        });
		
		        //表单验证
		        $("#formSubmit").validate({
		            rules:{
		                'status':{
		                    required:true,
		                },
		            },
		            onkeyup:false,
		            focusCleanup:true,
		            success:"valid",
		            submitHandler:function(form){
		                $(form).ajaxSubmit({
		                    type: 'post',
		                    success: function(data){
		                        console.log("==data==",data)
		                        data = JSON.parse(data);
		                        layer.msg(data.info,{icon:1,time:3000},function(){
		                            /* 关闭当前窗口 */
		                            if (data.code == '0') {
		                                var index = parent.layer.getFrameIndex(window.name);
		                                parent.$('.btn-refresh').click();
		                                parent.layer.close(index);
		                            }
		                        });
		                    },
		                    error: function(XmlHttpRequest, textStatus, errorThrown){
		                        layer.msg('error!',{icon:1,time:1000});
		                    }
		                });
		            }
		        });
		    });
		</script>
    </body>
</html>